package org.vartist.atld.menu.listener.util.device;

import org.vartist.atld.R;
import org.vartist.atld.menu.activity.util.device.DeviceActivity;
import org.vartist.atld.util.log.LogUtil;

import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.view.View.OnClickListener;

public class SetCallingDataClickListener implements OnClickListener {

	private DeviceActivity mActivity = null;
	private String mCallingNumber = null;
	
	public SetCallingDataClickListener(DeviceActivity activity, String callingNumber) {
		mActivity = activity;
		mCallingNumber = callingNumber;
	}
	
	@Override
	public void onClick(View v) {
		if (mCallingNumber != null && mCallingNumber.length() > 0) {
			Intent callIntent = new Intent(Intent.ACTION_DIAL);
			callIntent.setData(Uri.parse("tel:" + mCallingNumber));
			mActivity.startActivity(callIntent);			
		} else {
			LogUtil.e("calling number " + mActivity.getString(R.string.data_is_null));
		}

	}

}
